/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.DragonPokerServer.Rules;

import java.util.ArrayList;
import org.DragonPokerServer.Classes.Card;
import org.DragonPokerServer.Classes.HandPlayer;
import org.DragonPokerServer.Classes.Points;
import org.DragonPokerServer.Thread.ThreadUser;

/**
 *
 * @author gonçalo.margalho
 */
public abstract class GenericRule {

        protected GenericRule next = null;
        private ArrayList<Card> cards = null;
        private int points;

    public abstract int processRequest(ArrayList<Card> cards, HandPlayer hp);

    public abstract boolean isToProcessing(ArrayList<Card> cards, HandPlayer hp);

    public abstract ArrayList getWinners(ArrayList<Card> communityCards, ArrayList<HandPlayer> playerCards);

    public Object startProcessing(ArrayList<Card> cards, HandPlayer hp) {
        System.out.println("SERVER: chain " + getClass().getName());
        if (isToProcessing(cards, hp) == true) {
            processRequest(cards, hp);
        } else {
            if (next != null) {
                next.startProcessing(cards,hp);
            }
        }
        return getClass();
    }

    public GenericRule getNext() {
        return next;
    }

    public void setNext(GenericRule next) {
        this.next = next;
    }

    public ArrayList<Card> getCards() {
        return cards;
    }

    public void setCards(ArrayList<Card> cards) {
        this.cards = cards;
    }

    public int getPoints() {
        return points;
    }

    public void setPoints(int points) {
        this.points = points;
    }

    
}
